ggplot(penguins) + aes(x = species, y = bill_depth_mm) + geom_boxplot()
Grouped Boxplot
ggplot(penguins) + aes(x = species, y = bill_depth_mm, color = island) + geom_boxplot()
Some additional options
ggplot(data = penguins) + aes(x = bill_length_mm, y = bill_depth_mm, color = species) + geom_point() + labs(x = “Bill Length”, y = “Bill Depth”, title = “Comparison of penguin bill length and bill depth across species”) + scale_x_continuous(limits = c(30, 60))
Summary of options
data
geom_point: x, y, color, shape
geom_line: x, y, group, color
geom_histogram: x, y, fill
geom_bar: x, fill
geom_boxplot: x, y, fill, color
facet_wrap
labs
scale_x_continuous
scale_y_continuous
scale_x_discrete
scale_y_discrete
esquisse as a helper
Consider the esquisse package to help generate your ggplot code via drag and drop.